#pragma warning disable 108
using System;
using System.Runtime.InteropServices;
using System.Collections.Generic;
using Cephei;
using Cephei.Core;
using Cephei.Core.Generic;
using Microsoft.FSharp.Core;
using Cephei.QL.Times;
using Cephei.QL.Termstructures;
using Cephei.QL.Instruments;
using Cephei.QL;
namespace Cephei.QL.Experimental.Credit
{
    /// <summary> 
	/// ! A NTD instrument exchanges protection against the nth default in a basket of underlying credits for premium payments based on the protected notional amount.  The pricing is analogous to the pricing of a CDS instrument which represents protection against default of a single underlying credit.  The only difference is the calculation of the probability of default.  In the CDS case, it is the probabilty of single name default; in the NTD case the probability of at least N defaults in the portfolio of underlying credits.  This probability is computed using the algorithm in John Hull and Alan White, "Valuation of a CDO and nth to default CDS without Monte Carlo simulation", Journal of Derivatives 12, 2, 2004.  The algorithm allows for varying probability of default across the basket. Otherwise, for identical probabilities of default, the probability of n defaults is given by the binomial distribution.  Default correlation is modeled using a one-factor Gaussian copula approach.  The class is tested against data in Hull-White (see reference above.)
	/// </summary>
    [Guid ("3004F224-635E-4454-888C-66894CAF3E99"),ComVisible(true)]
	public interface INthToDefault : Cephei.QL.IInstrument
	{
		///////////////////////////////////////////////////////////////
        // Methods
        //
        /// <summary> 
		/// 
		/// </summary>
		 UInt64 BasketSize {get;}
        /// <summary> 
		/// 
		/// </summary>
		 Cephei.QL.Times.IDayCounter DayCounter {get;}
        /// <summary> 
		/// 
		/// </summary>
		 Double FairPremium {get;}
        /// <summary> 
		/// 
		/// </summary>
		 Boolean IsExpired {get;}
        /// <summary> 
		/// 
		/// </summary>
		 Double Nominal {get;}
        /// <summary> 
		/// 
		/// </summary>
		 Double Premium {get;}
        /// <summary> 
		/// 
		/// </summary>
		 UInt64 Rank {get;}
        /// <summary> 
		/// 
		/// </summary>
		 QL.Protection.SideEnum Side {get;}
    }   

    /// <summary> 
	/// ! A NTD instrument exchanges protection against the nth default in a basket of underlying credits for premium payments based on the protected notional amount.  The pricing is analogous to the pricing of a CDS instrument which represents protection against default of a single underlying credit.  The only difference is the calculation of the probability of default.  In the CDS case, it is the probabilty of single name default; in the NTD case the probability of at least N defaults in the portfolio of underlying credits.  This probability is computed using the algorithm in John Hull and Alan White, "Valuation of a CDO and nth to default CDS without Monte Carlo simulation", Journal of Derivatives 12, 2, 2004.  The algorithm allows for varying probability of default across the basket. Otherwise, for identical probabilities of default, the probability of n defaults is given by the binomial distribution.  Default correlation is modeled using a one-factor Gaussian copula approach.  The class is tested against data in Hull-White (see reference above.) Factory
	/// </summary>
   	[ComVisible(true)]
    public interface INthToDefault_Factory 
    {
        ///////////////////////////////////////////////////////////////
        // Factory methods
        //
        /// <summary> 
		/// 
		/// </summary>
	    INthToDefault Create (UInt64 n, Cephei.Core.IVector<Cephei.QL.Termstructures.IDefaultProbabilityTermStructure> probabilities, Double recoveryRate, Cephei.QL.Experimental.Credit.IOneFactorCopula copula, QL.Protection.SideEnum side, Double nominal, Cephei.QL.Times.ISchedule premiumSchedule, Double premiumRate, Cephei.QL.Times.IDayCounter dayCounter, Boolean settlePremiumAccrual, Cephei.QL.Termstructures.IYieldTermStructure yieldTS, Cephei.QL.Times.IPeriod integrationStepSize, Microsoft.FSharp.Core.FSharpOption<Cephei.QL.Instruments.IClaim> claim, Cephei.QL.IPricingEngine QL_Pricer);
    }
}

